﻿<div class="row" ng-controller="totalController" ng-init="initTotal(dataItem.LoadingPorts, dataItem.DischargePorts, dataItem.Id)">
    <div class="col-sm-5">
        <div name="ownerForm" class="form-horizontal well" role="form">
            <div ng-controller="PortCtrl"
                ng-init="init(dataItem.LoadingPorts,'load')">
                @Html.Partial("_portsManageForm")
            </div>
        </div>
    </div>
    <div class="col-sm-5">
        <div name="ownerForm" class="form-horizontal well" role="form">
            <div ng-controller="PortCtrl"
                ng-init="init(dataItem.DischargePorts,'disch')">
                @Html.Partial("_portsManageForm")
            </div>
        </div>
    </div>
    <div class="col-sm-2">
        <div name="vesselForm" class="form-horizontal well" role="form">

            <div class="form-group">
                <div class="col-xs-12">
                    <label>Lay time</label>
                    <input type="text" class="form-control" step="1" min="0" ng-change="check(dataItem.LoadingPorts, dataItem.DischargePorts)" tabindex="-1" ng-keydown="changeSelectionLay($event, dataItem.Id)"
                           ng-model="lay.Time" />
                </div>
            </div>


            <div class="panel panel-danger">
                <div class="panel-body">
                    <div class="form-group" style="margin-bottom: 5px">
                        <label class="col-xs-12">Total time used in hours: </label>
                        <div class="col-xs-12"><p class="bg-warning">{{toFixed(total.load+total.discharge)}}</p></div>
                    </div>
                    <div class="form-group" style="margin-bottom: 5px">
                        <label class="col-xs-12">Laytime allowed: </label>
                        <div class="col-xs-12"><p class="bg-warning">{{toFixed(lay.TimeNum)}}</p></div>
                    </div>
                    <div class="form-group" style="margin-bottom: 0px">
                        <label class="col-xs-12">Time on demurrage: </label>
                        <div class="col-xs-12"><p class="bg-warning">{{toFixed(total.load+total.discharge-lay.TimeNum)}}</p></div>
                    </div>
                </div>
            </div>
            <div class="panel panel-default"
                 ng-show="(total.load+total.discharge-lay.TimeNum)<=0 || (total.load+total.discharge-lay.TimeNum)>0 && !isComplete()">
                <div class="panel-heading text-center" style="background-color: white">
                    <div class="panel-title">No demurrage incurred</div>
                </div>
            </div>
            <div class="panel panel-danger" ng-show="(total.load+total.discharge-lay.TimeNum)>0 && isComplete()">
                <div class="panel-heading text-center">
                    <div class="panel-title">Demurrage incurred<span ng-show="checkStatus(dataItem.DemurrageStatus.value)"> & registered</span></div>
                </div>
            </div>
        </div>
    </div>
</div>
